package com.gxa.saas.portal.mapper;

import com.gxa.saas.core.vo.GoodsDetailsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Auther: pengxtao
 * @Date: 2022/7/22下午8:35
 */
@Mapper
public interface GoodsDetailsMapper {

    @Select(" SELECT pr.pr_name AS prName,pr.pr_price AS prPrice,pr.pr_id AS prId ,b.s_name AS sName FROM product pr,b_shop b WHERE pr.shop_id = b.s_id and pr_id=#{prId}")
    public GoodsDetailsVo selectDetailsGoods(@Param("prId") String prId);
    @Select(" SELECT p.picture_name AS picture FROM product pr,picture p WHERE  p.pro_id=pr.id AND pr.pr_id=#{prId}\n")
    public List<String> selectDetailsPicture(@Param("prId") String prId);
    @Select("SELECT ts.spe_name AS speName FROM tb_specification ts,product pr WHERE pr.id = ts.commodity_id AND pr.pr_id=#{prId}")
    public List<String> selectDetailsSpeName(@Param("prId") String prId);
    @Select("SELECT tc.col_name AS colorName FROM product pr,tb_color tc WHERE pr.id = tc.commodity_id AND pr.pr_id = #{prId}")
    public List<String> selectDetailColor(@Param("prId") String prId);
    @Select("SELECT first_classify.first_name AS firstName FROM first_classify,second_classify WHERE second_classify.se_name = (SELECT sc.se_name FROM product pr,second_classify sc, product_classify pc WHERE pr.id = pc.product_id AND sc.id = pc.classify_id AND pr.pr_id=#{prId} LIMIT 1) AND first_classify.id = second_classify.fc_id\n")
    public String selectDetailfirstCaly(@Param("prId") String prId);
    @Select("SELECT sc.se_name FROM product pr,second_classify sc, product_classify pc WHERE pr.id = pc.product_id AND sc.id = pc.classify_id AND pr.pr_id = #{prId}\n")
    public List<String> selectDetailsecondeCaly(@Param("prId") String prId);
}
